package cn.edu.scau.cmi.wujiaxian.exercise11;

import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;

public class Win extends JFrame{
	private static final long serialVersionUID = 4174621914605686809L;

	JTextField[] textFields = new JTextField[3];
	Police police;
	JButton button;
	
	public Win() {
		setLayout(new FlowLayout());
		police = new Police();
		for (int i = 0; i < 3; i++) {
			textFields[i] = new JTextField(7);
			textFields[i].addKeyListener(police);
			textFields[i].addFocusListener(police);
			add(textFields[i]);
 		}
		button = new JButton("确定");
		add(button);
		textFields[0].requestFocusInWindow();
		setVisible(true);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
	
}
